<?php

define("DIR",dirname($_SERVER['SCRIPT_FILENAME']));

 
$fp = fopen(DIR."\\2.txt","ab");
//flock($fp,LOCK_EX);   //锁定
;
for($i;$i<10;$i++){
    sleep(2);
    fwrite($fp, $i."释放\n");
}
//flock($fp, LOCK_UN);   //释放

fclose($fp);

//echo fgets($fp);
//fclose($fp);
